package com.lian.hope.mapper;

import com.lian.hope.model.po.SignInRecords;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface SignInRecordsMapper {
    /**
     * 查询用户是否今日已签到
     * @param userId
     * @return
     */
    @Select("select * from sign_in_records where  user_id = #{userId} and sign_in_date >= curdate() and sign_in_date " +
            "<= curdate() + interval  1 day")
    SignInRecords findByUserIdAndToday(Long userId);

    @Select("insert into sign_in_records(user_id,sign_in_date) values(#{userId},#{signInDate})")
    void insertSignInRecord(SignInRecords signInRecords);
}
